﻿
@{
    ViewData["Title"] = "用户登录                                                                                                                                   ";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<header class="mui-bar mui-bar-nav">
    <h1 class="mui-title">登录</h1>
</header>
<div class="mui-content">
    <form id='login-form' class="mui-input-group">
        <div class="mui-input-row">
            <label>账号</label>
            <input id='UserName' name="UserName" type="text" class="mui-input-clear mui-input" placeholder="请输入账号">
        </div>
        <div class="mui-input-row">
            <label>密码</label>
            <input id='UserPwd' name="UserPwd" type="password" class="mui-input-clear mui-input" placeholder="请输入密码">
        </div>
    </form>
    <div class="mui-content-padded">
        <button id='login' type="button" onclick="Login()" class="mui-btn mui-btn-block mui-btn-primary">登录</button>
        <div class="link-area">
            <a id='reg' href="/User/Reg">注册账号</a> <span class="spliter">|</span> <a href="" id='forgetPassword'>忘记密码</a>
        </div>
    </div>
    <div class="mui-content-padded oauth-area">

    </div>
</div>
<script type="text/javascript">
    function Login()
    {
        var model = {};
        model.UserName = $("#UserName").val();
        model.UserPwd = $("#UserPwd").val();
        DoGetAction(model, "/User/LoginDo");
    }
    function DoGetAction(model, url) {
        $.ajax({
            type: 'get',
            url: url,
            dataType: "json",
            data: model,
            success: function (data) {
                if (data.code == 100) {
                    mui.alert(data.msg, '温馨提示：', function () {
                        window.location.href = "/MerchantInfo/Index";
                    });
                }
                else {
                    mui.toast(data.msg);
                }
            }
        });
    }
</script>
